package com.maimao.upload;

import com.maimao.core.interceptor.FeignInterceptor;
import com.maimao.upload.config.properties.CacheProperties;
import com.maimao.upload.config.properties.UploadProperties;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.web.context.request.RequestContextListener;

/**
 * @author MaoLin Wang
 * @date 2020/12/10 4:24 下午
 */
@RefreshScope
@SpringBootApplication
@ComponentScan(basePackages = {"com.maimao.core"})
@ComponentScan(basePackages = {"com.maimao.api"})
@ComponentScan(basePackages = {"com.maimao.upload"})
@EnableDiscoveryClient
@EnableFeignClients
@EnableAsync
@EnableAspectJAutoProxy(proxyTargetClass = true, exposeProxy = true)
@Configuration
@EnableConfigurationProperties({UploadProperties.class, CacheProperties.class})
public class UploadApplication {
    public static void main(String[] args) {
        SpringApplication.run(UploadApplication.class, args);
    }
    @Bean
    public FeignInterceptor feignInterceptor(){
        return new FeignInterceptor();
    }
    @Bean
    public RequestContextListener requestContextListener(){
        return new RequestContextListener();
    }
}
